import axios from 'axios';

//  查询学生
async function selectStudent(getData) {

    let params = {

        page: getData.page,
        size: getData.size

    }

    // 通过名字查询
    if ( getData.name ) {
        params.name = getData.name
    }

    // 通过班级查询
    if ( getData.class ) {
        params.class = getData.class
    }



    try {
        const response = await axios.get('/select-student', {
            params: params
        });
        
        return response.data;
    } catch (error) {
        // Handle error appropriately
        console.error('Error fetching data:', error);
        throw error; // Optionally re-throw the error
    }
}
export default selectStudent;